//
// Created by hsj on 2022/1/13.
//
#include <iostream>
#include "t_class_use.h"

my_class_use_hsj::Time::Time() {
    hours = minutes = 0;
}

my_class_use_hsj::Time::Time(int h, int m) {
    hours = h;
    minutes = m;
}

void my_class_use_hsj::Time::addMin(int m){
    minutes += m;
    hours += minutes / 60;
    minutes %= 60;
}

void my_class_use_hsj::Time::addHr(int h){
    hours += h;
}

void my_class_use_hsj::Time::reset(int h,int m){
    hours = h;
    minutes = m;
}

my_class_use_hsj::Time my_class_use_hsj::Time::sum(const my_class_use_hsj::Time &t) const{
     Time sum;
     sum.minutes = minutes + t.minutes;
     sum.hours = hours + t.hours + sum.minutes / 60;
     sum.minutes %= 60;
     return sum;
}

void my_class_use_hsj::Time::show() const{
    std::cout<<"hours: "<<hours<<" minutes: "<<minutes<<std::endl;
}

my_class_use_hsj::Time my_class_use_hsj::Time::operator+(const my_class_use_hsj::Time &t) const{
    Time sum;
    sum.minutes = minutes + t.minutes;
    sum.hours = hours + t.hours + sum.minutes / 60;
    sum.minutes %= 60;
    return sum;
}
